home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
forms
/
fadeform
/
fade.bas
next >
Wrap
BASIC Source File
|
1994-12-10
|
2KB
|
56 lines
Option Explicit
' Copyright (c) 1994 Jwpc 1995, inc.
' this can be displayed in Super VGA, etc. colors!
' changes for each amt. of colors!
' Change where the word RED or BLUE is, in the order of the RGB order.
' ......RGB(Blue,0,0) = 255 of RED!
' ......RGB(0,0,Blue) = 255 of BLUE!
' Data type used by FillRect
Type RECT
Left As Integer
Top As Integer
Right As Integer
Bottom As Integer
End Type
' API Functions used to create solid brush and draw brush on form
Declare Function CreateSolidBrush Lib "GDI" (ByVal crColor As Long) As Integer
Declare Function FillRect Lib "User" (ByVal hDC As Integer, lpRect As RECT, ByVal hBrush As Integer) As Integer
Declare Function DeleteObject Lib "GDI" (ByVal hObject As Integer) As Integer
Dim hBrush%
Sub fadeform (TheForm As Form)
Dim FormHeight%, red%, StepInterval%, X%, RetVal%, OldMode%
Dim FillArea As RECT
OldMode = TheForm.ScaleMode
TheForm.ScaleMode = 3 'Pixel
FormHeight = TheForm.ScaleHeight
' Divide the form into 63 regions
StepInterval = FormHeight \ 63
red = 255
FillArea.Left = 0
FillArea.Right = TheForm.ScaleWidth
FillArea.Top = 0
FillArea.Bottom = StepInterval
For X = 1 To 63
hBrush% = CreateSolidBrush(RGB(0, 0, red))
RetVal% = FillRect(TheForm.hDC, FillArea, hBrush)
RetVal% = DeleteObject(hBrush)
red = red - 4
FillArea.Top = FillArea.Bottom
FillArea.Bottom = FillArea.Bottom + StepInterval
Next
' Fill the remainder of the form with black
FillArea.Bottom = FillArea.Bottom + 63
hBrush% = CreateSolidBrush(RGB(0, 0, 0))
RetVal% = FillRect(TheForm.hDC, FillArea, hBrush)
RetVal% = DeleteObject(hBrush)
TheForm.ScaleMode = OldMode
End Sub